using System;
using System.Drawing;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX.DirectInput;
using TgcViewer;
using TgcViewer.Utils.TgcGeometry;
using TgcViewer.Utils.TgcKeyFrameLoader;
using TgcViewer.Utils.Input;


namespace AlumnoEjemplos.zanellaSports
{
    public class Player
    {
        public Vehicle personaje;

        //Constructor
        public Player()
        {
            //Creo el vehiculo que va a usar el jugador
            personaje = new Vehicle();
        }

        public void update(float elapsedTime)
        {
            TgcD3dInput d3dInput = GuiController.Instance.D3dInput;

            Vector2 input = new Vector2(0, 0);
            //Adelante
            if (d3dInput.keyDown(Key.W))
            {
                input.X = 1;
            }

            //Atras
            if (d3dInput.keyDown(Key.S))
            {
                input.X = -1;
            }

            //Derecha
            if (d3dInput.keyDown(Key.D))
            {
                input.Y = 1;
            }

            //Izquierda
            if (d3dInput.keyDown(Key.A))
            {
                input.Y = -1;
            }

            personaje.update(input, elapsedTime);
        }
        public void render(float elapsedTime)
        {
            personaje.render(elapsedTime);
        }

        public Vector3 Position()
        {
            return personaje.Position();
        }

        public void dispose()
        {
            personaje.dispose();
        }
    }
}